﻿// ==========================================================
// File: TeamWorkNet.Base.TodoItem.cs
// Created: 14.02.2015
// Created By: Tim cadenbach
// 
// Copyright (C) 2015 Tim Cadenbach
// License: Apache License 2.0
// ==========================================================

using System;
using Newtonsoft.Json;
using TeamWorkNet.Extensions.DateTime;

namespace  TeamWorkNet.Model
{
  public class TodoItem
  {
    [JsonProperty("project-id")]
    public int ProjectId { get; set; }

    [JsonProperty("completer_lastname")]
    public string CompleterLastname { get; set; }

    [JsonProperty("order")]
    public string Order { get; set; }

    [JsonProperty("comments-count")]
    public string CommentsCount { get; set; }

    [JsonProperty("created-on")]
    private string createdOn { get; set; }

    public DateTime CreatedOn
    {
      get { return createdOn.ToDateTimeExactMin(); }
    }

    [JsonProperty("canEdit")]
    public bool CanEdit { get; set; }

    [JsonProperty("has-predecessors")]
    public string HasPredecessors { get; set; }

    [JsonProperty("id")]
    public string Id { get; set; }

    [JsonProperty("completed")]
    public bool Completed { get; set; }

    [JsonProperty("position")]
    public string Position { get; set; }

    [JsonProperty("estimated-minutes")]
    public string EstimatedMinutes { get; set; }

    [JsonProperty("description")]
    public string Description { get; set; }

    [JsonProperty("progress")]
    public string Progress { get; set; }

    [JsonProperty("harvest-enabled")]
    public bool HarvestEnabled { get; set; }

    [JsonProperty("parentTaskId")]
    public string ParentTaskId { get; set; }

    [JsonProperty("responsible-party-lastname")]
    public string ResponsiblePartyLastname { get; set; }

    [JsonProperty("company-id")]
    public string CompanyId { get; set; }

    [JsonProperty("creator-avatar-url")]
    public string CreatorAvatarUrl { get; set; }

    [JsonProperty("creator-id")]
    public string CreatorId { get; set; }

    [JsonProperty("project-name")]
    public string ProjectName { get; set; }

    [JsonProperty("start-date")]
    private string startDate { get; set; }

    public DateTime StartDate
    {
      get { return startDate.ToDateTimeExactMin(); }
      set { startDate = value.ToString("yyyyMMdd"); }
    }

    [JsonProperty("tasklist-private")]
    public string TasklistPrivate { get; set; }

    [JsonProperty("lockdownId")]
    public string LockdownId { get; set; }

    [JsonProperty("canComplete")]
    public bool CanComplete { get; set; }

    [JsonProperty("responsible-party-id")]
    public string ResponsiblePartyId { get; set; }

    [JsonProperty("creator-lastname")]
    public string CreatorLastname { get; set; }

    [JsonProperty("has-reminders")]
    public bool HasReminders { get; set; }

    [JsonProperty("todo-list-name")]
    public string TodoListName { get; set; }

    [JsonProperty("has-unread-comments")]
    public bool HasUnreadComments { get; set; }

    [JsonProperty("due-date-base")]
    private string dueDateBase;

    public DateTime DueDateBase
    {
      get { return dueDateBase.ToDateTimeExactMax(); }
      set { dueDateBase = value.ToString("yyyyMMdd"); }
    }

    [JsonProperty("private")]
    public string Private { get; set; }

    [JsonProperty("responsible-party-summary")]
    public string ResponsiblePartySummary { get; set; }

    [JsonProperty("status")]
    public string Status { get; set; }

    [JsonProperty("todo-list-id")]
    public string TodoListId { get; set; }

    [JsonProperty("predecessors")]
    public object[] Predecessors { get; set; }

    [JsonProperty("content")]
    public string Content { get; set; }

    [JsonProperty("responsible-party-type")]
    public string ResponsiblePartyType { get; set; }

    [JsonProperty("company-name")]
    public string CompanyName { get; set; }

    [JsonProperty("creator-firstname")] 
    public string CreatorFirstname { get; set; }

    [JsonProperty("last-changed-on")]
    public string lastChangedOn;
    public DateTime lastChangedOnDueDate
    {
      get { return lastChangedOn.ToDateTimeExactMax(); }
      set { lastChangedOn = value.ToString("yyyyMMdd"); }
    }

    [JsonProperty("due-date")]
    private string dueDate;

    public DateTime DueDate
    {
      get { return dueDate.ToDateTimeExactMax(); }
      set { dueDate = value.ToString("yyyyMMdd"); }
    }

    [JsonProperty("completed_on")]
    public string completedOn;
    public DateTime CompletedOn
    {
      get { return completedOn.ToDateTimeExactMax(); }
      set { completedOn = value.ToString("yyyyMMdd"); }
    }

    [JsonProperty("has-dependencies")]
    public string HasDependencies { get; set; }

    [JsonProperty("attachments-count")]
    public string AttachmentsCount { get; set; }

    [JsonProperty("priority")]
    public string Priority { get; set; }

    [JsonProperty("completer_id")]
    public string CompleterId { get; set; }

    [JsonProperty("responsible-party-firstname")]
    public string ResponsiblePartyFirstname { get; set; }

    [JsonProperty("viewEstimatedTime")]
    public bool ViewEstimatedTime { get; set; }

    [JsonProperty("responsible-party-ids")]
    public string ResponsiblePartyIds { get; set; }

    [JsonProperty("responsible-party-names")]
    public string ResponsiblePartyNames { get; set; }

    [JsonProperty("completer_firstname")]
    public string CompleterFirstname { get; set; }

    [JsonProperty("tasklist-lockdownId")]
    public string TasklistLockdownId { get; set; }

    [JsonProperty("canLogTime")]
    public bool CanLogTime { get; set; }

    [JsonProperty("timeIsLogged")]
    public string TimeIsLogged { get; set; }

    [JsonProperty("subTasks")]
    public TodoItem[] SubTasks { get; set; }
  
  }
}